package com.ztil.socket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class Read implements Runnable {

	private Socket _readSocket;
	private BufferedReader _br;
	private String _result;

	public Read(Socket socket) {
		this._readSocket = socket;
		try {
			this._br = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF8"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void run() {
		try {
			while (null != (_result = _br.readLine())) {
				System.out.println(_readSocket.getRemoteSocketAddress() + "--->>>" + _result);
			}
		} catch (IOException e) {
//			e.printStackTrace();
		}
	}
}